package utilities;

import static com.googlecode.javacv.cpp.opencv_highgui.CV_IMWRITE_JPEG_QUALITY;
import static com.googlecode.javacv.cpp.opencv_highgui.cvSaveImage;
import servers.Dragon;

import com.googlecode.javacv.OpenCVFrameGrabber;
import com.googlecode.javacv.cpp.opencv_core.IplImage;

public class TakePicture {


    public static void main(String[] args) throws Exception	{
	//post this data to app controller at appDir
    	System.out.println("Getting grabber");
    	OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(0);
        grabber.start();
        IplImage frame = grabber.grab();  
 
	        int i=0;
	        while (i<8) {
	        	frame=grabber.grab();
	            i++;
	        }
	        int p[]=new int[3];
	        p[0] = CV_IMWRITE_JPEG_QUALITY;
	        p[1] = 50;
	        p[2] = 0;
	        cvSaveImage("c:\\temp\\dragonImage.jpg", frame, p);
	        grabber.stop();
	    	System.out.println("saved image, grabber stopped");
	}	
}
